package com.dmlll.service.impl;

import com.dmlll.VO.*;
import com.dmlll.domain.*;
import com.dmlll.mapper.DrugMessageMapper;
import com.dmlll.service.DrugMessageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dmLll
 * @since 2021-03-31
 */
@Service
public class DrugMessageServiceImpl extends ServiceImpl<DrugMessageMapper, DrugMessage> implements DrugMessageService {

    @Autowired
    private DrugMessageMapper drugMessageMapper;

    @Override
    public PageInfo<ZjsVO> selectCatalogue(Integer pageNum, Integer pageSize, String serialNumber, String commonName, String dosageForm, String size, String unit, Integer factor, String category) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsVO>list = drugMessageMapper.selectCatalogue(serialNumber,commonName,dosageForm,size,unit,factor,category);
        PageInfo<ZjsVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    //勾选导出
    @Override
    public List<ZjsVO> findByIdList(Integer[] idList) {
        return drugMessageMapper.selectByIdList(idList);
    }

    @Override
    public PageInfo<ZjsinformationVO> selectDrugInformation(Integer pageNum, Integer pageSize, String serialNumber, String commonName, String dosageForm, String size, String unit, Integer factor, String productionName,Double winPrice, String commodityName, Double winPriceMin, Double winPriceMax,String category, Integer quality,Integer transaction) {
       PageHelper.startPage(pageNum,pageSize);
       List<ZjsinformationVO> list = drugMessageMapper.selectDrugInformation(serialNumber,commonName,dosageForm,size,unit,factor,productionName,winPrice,commodityName,winPriceMin,winPriceMax,category,quality,transaction);
        PageInfo<ZjsinformationVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<ZjsinformationVO> selectZjsList() {
        return drugMessageMapper.selectZjsList();
    }

    @Override
    public PageInfo<ZjsinformationVO> selectDrugInformationList(Integer pageNum, Integer pageSize, String serialNumber, String commonName, String dosageForm, String size, String unit, Integer factor, String productionName, Double winPrice, String commodityName, Double winPriceMin, Double winPriceMax, String category, Integer quality, Integer transaction) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsinformationVO> list = drugMessageMapper.selectDrugInformationList(serialNumber,commonName,dosageForm,size,unit,factor,productionName,winPrice,commodityName,winPriceMin,winPriceMax,category,quality,transaction);
        PageInfo<ZjsinformationVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<ProviderDrugCatalogControl> insertIdList(Integer[] idList) {
        return drugMessageMapper.insertIdList(idList);
    }

    @Override
    public int insertPurchase(HospitalPurchaseCatalog[] hospitalPurchaseCatalogs) {
        return drugMessageMapper.insertPurchase(hospitalPurchaseCatalogs);
    }

    @Override
    public PageInfo<ZjsinformationVO> selectMaintain(Integer pageNum, Integer pageSize, String serialNumber, String commonName, String dosageForm, String size, String unit, Integer factor, String productionName, Double winPrice, String commodityName, Double winPriceMin, Double winPriceMax, String category, Integer quality, Integer transaction) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsinformationVO> list = drugMessageMapper.selectMaintain(serialNumber,commonName,dosageForm,size,unit,factor,productionName,winPrice,commodityName,winPriceMin,winPriceMax,category,quality,transaction);
        PageInfo<ZjsinformationVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int delectMaintain(Integer[] idList) {
        return drugMessageMapper.delectMaintain(idList);
    }

    @Override
    public List<ZjsinformationVO> selectMaintainIdList(Integer[] idList) {
        return drugMessageMapper.selectMaintainIdList(idList);
    }

    @Override
    public List<Provider> selectProviderIdName() {
        return drugMessageMapper.selectProviderIdName();
    }

    @Override
    public PageInfo<ZjsSalesReturnVO> selectSalesReturnCatalogue(ZjsSalesReturnVO zjsSalesReturnVO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsSalesReturnVO> list = drugMessageMapper.selectSalesReturnCatalogue(zjsSalesReturnVO);
        PageInfo<ZjsSalesReturnVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PageInfo<ZjsGoodsNoteVO> selectGoodsNote(ZjsGoodsNoteVO zjsGoodsNoteVO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsGoodsNoteVO> list = drugMessageMapper.selectGoodsNote(zjsGoodsNoteVO);
        PageInfo<ZjsGoodsNoteVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int insertGoodsNote(HospitalOutput hospitalOutput) {
        return drugMessageMapper.insertGoodsNote(hospitalOutput);
    }

    @Override
    public List<ZjsGoodsNoteVO> selectIdReturn(Integer Sid) {
        return drugMessageMapper.selectIdReturn(Sid);
    }

    @Override
    public PageInfo<ZjsAddquantityVO> selectAddquantity(ZjsAddquantityVO zjsAddquantityVO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsAddquantityVO> list = drugMessageMapper.selectAddquantity(zjsAddquantityVO);
        PageInfo<ZjsAddquantityVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int insertAddquantity(HospitalOutputDetail[] hospitalOutputDetail) {
        return drugMessageMapper.insertAddquantity(hospitalOutputDetail);
    }

    @Override
    public List<PurchaseDrupDetail> selectInsertValue(Integer[] idList) {
        return drugMessageMapper.selectInsertValue(idList);
    }

    @Override
    public int delectReturn(Integer[] idList) {
        return drugMessageMapper.delectReturn(idList);
    }

    @Override
    public PageInfo<ZjsFinalStatementVO> selectFinal(ZjsFinalStatementVO zjsFinalStatementVO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsFinalStatementVO> list = drugMessageMapper.selectFinal(zjsFinalStatementVO);
        PageInfo<ZjsFinalStatementVO>pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int insertFinal(HospitalClose hospitalClose) {
        return drugMessageMapper.insertFinal(hospitalClose);
    }

    @Override
    public int updateQuantity(Integer id){
        return drugMessageMapper.updateQuantity(id);
    }

    @Override
    public int delectSalesDrug(Integer[] idList) {
        return drugMessageMapper.delectSalesDrug(idList);
    }

    @Override
    public PageInfo<ZjsClearingDrugs> selectClearing(ZjsClearingDrugs zjsClearingDrugs,Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsClearingDrugs> list = drugMessageMapper.selectClearing(zjsClearingDrugs);
        PageInfo<ZjsClearingDrugs> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<ZjsSelectClearingVO> selectFinalParticulars(Integer id) {
        return drugMessageMapper.selectFinalParticulars(id);
    }

    @Override
    public int updateCloseState(Integer id) {
        return drugMessageMapper.updateCloseState(id);
    }

    @Override
    public int deleteFinalDrug(Integer[] idList) {
        return drugMessageMapper.deleteFinalDrug(idList);
    }

    @Override
    public PageInfo<ZjsPurchaseOrdersVO> selectPurchase(ZjsPurchaseOrdersVO zjsPurchaseOrdersVO,Integer pageNum,Integer pageSize) {
      PageHelper.startPage(pageNum,pageSize);
      List<ZjsPurchaseOrdersVO> list = drugMessageMapper.selectPurchase(zjsPurchaseOrdersVO);
      PageInfo<ZjsPurchaseOrdersVO> pageInfo = new PageInfo<>(list);
      return pageInfo;
    }

    @Override
    public List<ZjsPurchaseOrdersVO> selectPurchaseByIdList(Integer[] idList) {
        return drugMessageMapper.selectPurchaseByIdList(idList);
    }

    @Override
    public PageInfo<ZjsSupplierVO> selectSupplier(ZjsSupplierVO zjsSupplierVO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsSupplierVO> list = drugMessageMapper.selectSupplier(zjsSupplierVO);
        PageInfo<ZjsSupplierVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<ZjsSupplierVO> selectSupplierByIdList(Integer[] idList) {
        return drugMessageMapper.selectSupplierByIdList(idList);
    }

    @Override
    public List<Hospital> selectHospitalIdName() {
        return drugMessageMapper.selectHospitalIdName();
    }

    @Override
    public PageInfo<ZjsHospitalStatisticsVO> selectHospitalStatistics(ZjsHospitalStatisticsVO zjsHospitalStatisticsVO,Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsHospitalStatisticsVO> list = drugMessageMapper.selectHospitalStatistics(zjsHospitalStatisticsVO);
        PageInfo<ZjsHospitalStatisticsVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<ZjsHospitalStatisticsVO> selectHospitalByIdList(Integer[] idList) {
        return drugMessageMapper.selectHospitalByIdList(idList);
    }

    @Override
    public PageInfo<ZjsDealStatisticsVO> selectDeal(ZjsDealStatisticsVO zjsDealStatisticsVO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ZjsDealStatisticsVO> list = drugMessageMapper.selectDeal(zjsDealStatisticsVO);
        PageInfo<ZjsDealStatisticsVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<ZjsDealStatisticsVO> selectDealByIdList(Integer[] idList) {
        return drugMessageMapper.selectDealByIdList(idList);
    }


}
